#coding=utf-8
'''1.自己写一个字典:
    name_dict = {'name':'ben','age':22,'sex':'男'}
    添加,删除,更新,清空操作'''
# name_dict={'name':'ben','age':22,'sex':'男'}
# name_dict["address"]='beijing'
# print(name_dict)#添加
# del name_dict['name']
# print(name_dict)#删除
# name_dict.pop('sex')
# print(name_dict)#删除
# name_dict['age']=28
# print(name_dict)#更新
# name_dict.clear()
# print(name_dict)#清空
#
# '''2.写两个集合:
#     num1_set = {3,5,1,2,7}
#     num2_set = {1,2,3,11}
#     并分别进行&,|,^,-运算
# '''
# num1_set = {3,5,1,2,7}
# num2_set = {1,2,3,11}
# print(num1_set&num2_set)
# print(num1_set|num2_set)
# print(num1_set^num2_set)
# print(num1_set-num2_set)

'''
3.整数字典:
    num_dict = {'a':13,'b':22,'c':18,'d':24}
    按照dict中value从小到大的顺序排序'''
num_dict = {'a':13,'b':22,'c':18,'d':24}

new_list=list(num_dict.values())
new_list_1=sorted(new_list)
num_dict1=dict(sorted(num_dict.items(),key=lambda item:item[1]))
# print(sorted(num_dict.items(),key=lambda item:item[1]))
print(num_dict1)
print(new_list_1)
q
def new_dict(a_dict):
    b_dict={}
    new_list = list(num_dict.values())
